<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件的传播与阻止</title>
    <style>
        .outer {
            width: 800px;
            height: 800px;
            background-color: skyblue;
        }
        .center {
            width: 400px;
            height: 400px;
            background-color: pink;
        }
        .inner {
            width: 200px;
            height: 200px;
            background-color: lime;
        }
    </style>
</head>
<body>
<div class="outer">
    <div class="center">
        <div class="inner"></div>
    </div>
</div>
<script>
    var outer = document.querySelector('.outer');
    var center = document.querySelector('.center');
    var inner = document.querySelector('.inner');

    outer.onclick = function () {console.log('outer被点击')}
    center.onclick = function () {console.log('center被点击')};
    inner.onclick = function (e) {
        e.stopPropagation();//事件的传播机制被阻止
        console.log('inner被点击')};
</script>
</body>
</html>